<div id="module_title" >
    <span>Danh sách phòng</span>
</div>
<?php include_once 'views/chuongtrinh/message_show.php';  ?>
<div id="system-message-container">
    <?php

        if(empty($success)  === false ){
            echo $success[0];
        }

        if(empty($errors)  === false ){
            echo $errors[0];
        }
    ?>
</div>

<table class="adminlist">
    <thead>
        <tr>
            <th width="2%" >#</th>
            <th class="left" >
                Tên Phòng
            </th>
            <th class="left">
                Mô Tả
            </th>
            <th class="left" >
                Trạng Thái
            </th>
            <th  colspan="2">Chức năng</th>
        </tr>
    </thead>
    <tbody>
     <?php

     $stt = 0;
     foreach ($rooms as $room) {
        if($stt % 2 == 0){
            $class='row0';
        } else {
            $class='row1';
        }

        echo '<tr class="'.$class.'" >';
            echo '<td>'.($stt + 1 ).'</td>';
            echo '<td>'.$room['room_name'].'</td>';
            echo '<td>'.$room['room_desc'].'</td>';
            echo '<td style="text-align: center" >';
            if ( $room['room_status'] == 0 ) {
                echo '<a href="index.php?mod=room&act=status&id='. $room['room_id'] .'&now='. $room['room_status'] .'" style="color: green; font-weight: bold;" >Bình Thường</a>';
            } elseif ( $room['room_status'] == 1 ) {
                echo '<a href="index.php?mod=room&act=status&id='. $room['room_id'] .'&now='. $room['room_status'] .'" style="color: red; font-weight: bold;" >Đang Bảo Trì</a>';
            }
            echo '</td>';
            echo '<td class="center"  ><a href="index.php?mod=room&act=edit&id='.$room['room_id'].'">Sửa</a></td>';
            echo '<td class="center" ><a onclick="if(!confirm(\'Bạn có chắc muốn xoá!\')) return false;" href="index.php?mod=room&act=del&id='.$room['room_id'].'">Xoá</a></td>';
        echo '</tr>';
         $stt ++;
     }

     ?>
    </tbody>
    <tfoot>

    </tfoot>
</table>